package com.hd.trans.db.bean;

import com.hd.trans.db.greenDao.DaoSession;
import com.hd.trans.db.greenDao.FileTranslateRecordDao;
import com.hd.trans.db.greenDao.HuDunLanguageDao;
import com.hd.trans.homefun.RecordType;

import org.greenrobot.greendao.DaoException;
import org.greenrobot.greendao.annotation.Entity;
import org.greenrobot.greendao.annotation.Generated;
import org.greenrobot.greendao.annotation.Id;
import org.greenrobot.greendao.annotation.Property;
import org.greenrobot.greendao.annotation.ToOne;

/**
 * Desc:    翻译记录
 */
@Entity
public class FileTranslateRecord {

    @Id(autoincrement = true)
    private Long id;

    private Long textLanguageFromId;//这是与语言关联的外键(文本)

    @ToOne(joinProperty = "textLanguageFromId") //这个是注解绑定 textLanguageFromId
    private HuDunLanguage textLanguageFrom;//对象--关联语言

    private Long textLanguageToId;//这是与语言关联的外键(文本)

    @ToOne(joinProperty = "textLanguageToId") //这个是注解绑定 textLanguageToId
    private HuDunLanguage textLanguageTo;//对象--关联语言

    private Long fileLanguageFromId;//这是与语言关联的外键(文件、图片)

    @ToOne(joinProperty = "fileLanguageFromId") //这个是注解绑定 fileLanguageFromId
    private HuDunLanguage fileLanguageFrom;//对象--关联语言

    private Long fileLanguageToId;//这是与语言关联的外键(文件、图片)

    @ToOne(joinProperty = "fileLanguageToId") //这个是注解绑定 fileLanguageToId
    private HuDunLanguage fileLanguageTo;//对象--关联语言

    @Property(nameInDb = "create_time")
    private long createTime = 0; //创建时间

    @Property(nameInDb = "update_time")
    private long updateTime = 0; //更新时间

    @Property(nameInDb = "original_text")
    private String originalText;//原文内容

    @Property(nameInDb = "translate_text")
    private String translateText;//译文内容

    @Property(nameInDb = "original_file_path")
    private String originalFilePath; //原文件路径

    @Property(nameInDb = "translate_file_path")
    private String translateFilePath; //译文文件路径

    @Property(nameInDb = "meta_file_path")
    private String metaFilePath; //文字坐标文件

    @Property(nameInDb = "inpainted_file_path")
    private String inpaintedFilePath; //擦除文字背景图

    @Property(nameInDb = "is_collected")
    private boolean isCollected;//是否被收藏

    @Property(nameInDb = "file_name")
    private String fileName;//原文内容

    @Property(nameInDb = "record_type")
    private int recordType = RecordType.IMAGE;//记录类型

    /**
     * @see com.hd.trans.common.Constants.VoiceRecordState
     */
    @Property(nameInDb = "record_state")
    private int translateState;//翻译状态

    /** Used to resolve relations */
    @Generated(hash = 2040040024)
    private transient DaoSession daoSession;

    /** Used for active entity operations. */
    @Generated(hash = 1751946550)
    private transient FileTranslateRecordDao myDao;

    @Generated(hash = 1822175672)
    public FileTranslateRecord(Long id, Long textLanguageFromId, Long textLanguageToId,
            Long fileLanguageFromId, Long fileLanguageToId, long createTime, long updateTime,
            String originalText, String translateText, String originalFilePath,
            String translateFilePath, String metaFilePath, String inpaintedFilePath,
            boolean isCollected, String fileName, int recordType, int translateState) {
        this.id = id;
        this.textLanguageFromId = textLanguageFromId;
        this.textLanguageToId = textLanguageToId;
        this.fileLanguageFromId = fileLanguageFromId;
        this.fileLanguageToId = fileLanguageToId;
        this.createTime = createTime;
        this.updateTime = updateTime;
        this.originalText = originalText;
        this.translateText = translateText;
        this.originalFilePath = originalFilePath;
        this.translateFilePath = translateFilePath;
        this.metaFilePath = metaFilePath;
        this.inpaintedFilePath = inpaintedFilePath;
        this.isCollected = isCollected;
        this.fileName = fileName;
        this.recordType = recordType;
        this.translateState = translateState;
    }

    @Generated(hash = 907951315)
    public FileTranslateRecord() {
    }

    public Long getId() {
        return this.id;
    }

    public void setId(Long id) {
        this.id = id;
    }

    public Long getTextLanguageFromId() {
        return this.textLanguageFromId;
    }

    public void setTextLanguageFromId(Long textLanguageFromId) {
        this.textLanguageFromId = textLanguageFromId;
    }

    public Long getTextLanguageToId() {
        return this.textLanguageToId;
    }

    public void setTextLanguageToId(Long textLanguageToId) {
        this.textLanguageToId = textLanguageToId;
    }

    public Long getFileLanguageFromId() {
        return this.fileLanguageFromId;
    }

    public void setFileLanguageFromId(Long fileLanguageFromId) {
        this.fileLanguageFromId = fileLanguageFromId;
    }

    public Long getFileLanguageToId() {
        return this.fileLanguageToId;
    }

    public void setFileLanguageToId(Long fileLanguageToId) {
        this.fileLanguageToId = fileLanguageToId;
    }

    public long getCreateTime() {
        return this.createTime;
    }

    public void setCreateTime(long createTime) {
        this.createTime = createTime;
    }

    public long getUpdateTime() {
        return this.updateTime;
    }

    public void setUpdateTime(long updateTime) {
        this.updateTime = updateTime;
    }

    public String getOriginalText() {
        return this.originalText;
    }

    public void setOriginalText(String originalText) {
        this.originalText = originalText;
    }

    public String getTranslateText() {
        return this.translateText;
    }

    public void setTranslateText(String translateText) {
        this.translateText = translateText;
    }

    public String getOriginalFilePath() {
        return this.originalFilePath;
    }

    public void setOriginalFilePath(String originalFilePath) {
        this.originalFilePath = originalFilePath;
    }

    public String getTranslateFilePath() {
        return this.translateFilePath;
    }

    public void setTranslateFilePath(String translateFilePath) {
        this.translateFilePath = translateFilePath;
    }

    public String getMetaFilePath() {
        return this.metaFilePath;
    }

    public void setMetaFilePath(String metaFilePath) {
        this.metaFilePath = metaFilePath;
    }

    public String getInpaintedFilePath() {
        return this.inpaintedFilePath;
    }

    public void setInpaintedFilePath(String inpaintedFilePath) {
        this.inpaintedFilePath = inpaintedFilePath;
    }

    public boolean getIsCollected() {
        return this.isCollected;
    }

    public void setIsCollected(boolean isCollected) {
        this.isCollected = isCollected;
    }

    public int getTranslateState() {
        return this.translateState;
    }

    public void setTranslateState(int translateState) {
        this.translateState = translateState;
    }

    public String getFileName() {
        return fileName;
    }

    public void setFileName(String fileName) {
        this.fileName = fileName;
    }

    public int getRecordType() {
        return recordType;
    }

    public void setRecordType(int recordType) {
        this.recordType = recordType;
    }

    @Generated(hash = 974967903)
    private transient Long textLanguageFrom__resolvedKey;

    /** To-one relationship, resolved on first access. */
    @Generated(hash = 820778157)
    public HuDunLanguage getTextLanguageFrom() {
        Long __key = this.textLanguageFromId;
        if (textLanguageFrom__resolvedKey == null
                || !textLanguageFrom__resolvedKey.equals(__key)) {
            final DaoSession daoSession = this.daoSession;
            if (daoSession == null) {
                throw new DaoException("Entity is detached from DAO context");
            }
            HuDunLanguageDao targetDao = daoSession.getHuDunLanguageDao();
            HuDunLanguage textLanguageFromNew = targetDao.load(__key);
            synchronized (this) {
                textLanguageFrom = textLanguageFromNew;
                textLanguageFrom__resolvedKey = __key;
            }
        }
        return textLanguageFrom;
    }

    /** called by internal mechanisms, do not call yourself. */
    @Generated(hash = 768614645)
    public void setTextLanguageFrom(HuDunLanguage textLanguageFrom) {
        synchronized (this) {
            this.textLanguageFrom = textLanguageFrom;
            textLanguageFromId = textLanguageFrom == null ? null
                    : textLanguageFrom.getId();
            textLanguageFrom__resolvedKey = textLanguageFromId;
        }
    }

    @Generated(hash = 340572006)
    private transient Long textLanguageTo__resolvedKey;

    /** To-one relationship, resolved on first access. */
    @Generated(hash = 521139802)
    public HuDunLanguage getTextLanguageTo() {
        Long __key = this.textLanguageToId;
        if (textLanguageTo__resolvedKey == null
                || !textLanguageTo__resolvedKey.equals(__key)) {
            final DaoSession daoSession = this.daoSession;
            if (daoSession == null) {
                throw new DaoException("Entity is detached from DAO context");
            }
            HuDunLanguageDao targetDao = daoSession.getHuDunLanguageDao();
            HuDunLanguage textLanguageToNew = targetDao.load(__key);
            synchronized (this) {
                textLanguageTo = textLanguageToNew;
                textLanguageTo__resolvedKey = __key;
            }
        }
        return textLanguageTo;
    }

    /** called by internal mechanisms, do not call yourself. */
    @Generated(hash = 1364628066)
    public void setTextLanguageTo(HuDunLanguage textLanguageTo) {
        synchronized (this) {
            this.textLanguageTo = textLanguageTo;
            textLanguageToId = textLanguageTo == null ? null
                    : textLanguageTo.getId();
            textLanguageTo__resolvedKey = textLanguageToId;
        }
    }

    @Generated(hash = 1222012895)
    private transient Long fileLanguageFrom__resolvedKey;

    /** To-one relationship, resolved on first access. */
    @Generated(hash = 1693137440)
    public HuDunLanguage getFileLanguageFrom() {
        Long __key = this.fileLanguageFromId;
        if (fileLanguageFrom__resolvedKey == null
                || !fileLanguageFrom__resolvedKey.equals(__key)) {
            final DaoSession daoSession = this.daoSession;
            if (daoSession == null) {
                throw new DaoException("Entity is detached from DAO context");
            }
            HuDunLanguageDao targetDao = daoSession.getHuDunLanguageDao();
            HuDunLanguage fileLanguageFromNew = targetDao.load(__key);
            synchronized (this) {
                fileLanguageFrom = fileLanguageFromNew;
                fileLanguageFrom__resolvedKey = __key;
            }
        }
        return fileLanguageFrom;
    }

    /** called by internal mechanisms, do not call yourself. */
    @Generated(hash = 2037184123)
    public void setFileLanguageFrom(HuDunLanguage fileLanguageFrom) {
        synchronized (this) {
            this.fileLanguageFrom = fileLanguageFrom;
            fileLanguageFromId = fileLanguageFrom == null ? null
                    : fileLanguageFrom.getId();
            fileLanguageFrom__resolvedKey = fileLanguageFromId;
        }
    }

    @Generated(hash = 1185409064)
    private transient Long fileLanguageTo__resolvedKey;

    /** To-one relationship, resolved on first access. */
    @Generated(hash = 1174751356)
    public HuDunLanguage getFileLanguageTo() {
        Long __key = this.fileLanguageToId;
        if (fileLanguageTo__resolvedKey == null
                || !fileLanguageTo__resolvedKey.equals(__key)) {
            final DaoSession daoSession = this.daoSession;
            if (daoSession == null) {
                throw new DaoException("Entity is detached from DAO context");
            }
            HuDunLanguageDao targetDao = daoSession.getHuDunLanguageDao();
            HuDunLanguage fileLanguageToNew = targetDao.load(__key);
            synchronized (this) {
                fileLanguageTo = fileLanguageToNew;
                fileLanguageTo__resolvedKey = __key;
            }
        }
        return fileLanguageTo;
    }

    /** called by internal mechanisms, do not call yourself. */
    @Generated(hash = 357300481)
    public void setFileLanguageTo(HuDunLanguage fileLanguageTo) {
        synchronized (this) {
            this.fileLanguageTo = fileLanguageTo;
            fileLanguageToId = fileLanguageTo == null ? null
                    : fileLanguageTo.getId();
            fileLanguageTo__resolvedKey = fileLanguageToId;
        }
    }

    /**
     * Convenient call for {@link org.greenrobot.greendao.AbstractDao#delete(Object)}.
     * Entity must attached to an entity context.
     */
    @Generated(hash = 128553479)
    public void delete() {
        if (myDao == null) {
            throw new DaoException("Entity is detached from DAO context");
        }
        myDao.delete(this);
    }

    /**
     * Convenient call for {@link org.greenrobot.greendao.AbstractDao#refresh(Object)}.
     * Entity must attached to an entity context.
     */
    @Generated(hash = 1942392019)
    public void refresh() {
        if (myDao == null) {
            throw new DaoException("Entity is detached from DAO context");
        }
        myDao.refresh(this);
    }

    /**
     * Convenient call for {@link org.greenrobot.greendao.AbstractDao#update(Object)}.
     * Entity must attached to an entity context.
     */
    @Generated(hash = 713229351)
    public void update() {
        if (myDao == null) {
            throw new DaoException("Entity is detached from DAO context");
        }
        myDao.update(this);
    }

    /** called by internal mechanisms, do not call yourself. */
    @Generated(hash = 808566411)
    public void __setDaoSession(DaoSession daoSession) {
        this.daoSession = daoSession;
        myDao = daoSession != null ? daoSession.getFileTranslateRecordDao() : null;
    }


}